//
//  MoreBrandCell.m
//  LoveTrail
//
//  Created by giantumbrella on 15/6/29.
//  Copyright (c) 2015年 赵娟. All rights reserved.
//

#import "MoreBrandCell.h"
#import "CommonMacro.h"

@interface MoreBrandCell ()
@property (nonatomic,strong) UIView *bgView;
@property (nonatomic,strong) UIView *topView;
@property (nonatomic,strong) UIView *smallModulView;
@property (nonatomic,strong) UIImageView *brandImageView;
@property (nonatomic,strong) UILabel *titleLabel;
@property (nonatomic,strong) UILabel *brandTitleLabel;

@end
@implementation MoreBrandCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self createBrandSpecilSubview];
    }
    return self;
}

- (void)createBrandSpecilSubview
{
    //1.大背景
    self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT*0.3)];
    [self addSubview:self.bgView];
    self.bgView.backgroundColor = UIColorWithRGBA(255, 255, 255, 1);
//    self.bgView.backgroundColor = [UIColor greenColor];
    
    //2.标题
    self.topView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.bgView.frame.size.width, self.bgView.frame.size.height*0.2)];
    [self.bgView addSubview:self.topView];
    self.topView.backgroundColor = UIColorWithRGBA(248, 111, 150, 1);
    //2.1
    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(5, 5, self.topView.frame.size.width*0.25,self.topView.frame.size.height-10)];
    [self.topView addSubview:self.titleLabel];
    self.titleLabel.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"主标题深底色"]];
    self.titleLabel.text = @"洗护清洁";
    self.titleLabel.textAlignment = NSTextAlignmentCenter;
    self.titleLabel.textColor = UIColorWithRGBA(253, 240, 243, 1);
    
    //3.图片 品牌
    CGFloat viewW = self.topView.frame.size.width*0.3;
    CGFloat viewH = self.bgView.frame.size.height*0.36;
    CGFloat MarrginX = 7;
    CGFloat MarrginY = 15;
    for (int i=0; i<3; i++) {
        
        CGFloat viewX = 10+(viewW+MarrginX)*i;
        
        for (int j=0; j<2; j++) {
            
            CGFloat viewY = self.topView.frame.size.height+self.topView.frame.origin.y+15+(MarrginY+viewH)*j;
            
            self.smallModulView = [[UIView alloc] initWithFrame:CGRectMake(viewX,viewY,viewW,viewH)];
            [self.bgView addSubview:self.smallModulView];
//            self.smallModulView.backgroundColor = [UIColor redColor];
            
            //3.1
            self.brandImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.smallModulView.frame.size.width, self.smallModulView.frame.size.height*0.6)];
            [self.smallModulView addSubview:self.brandImageView];
            self.brandImageView.image = [UIImage imageNamed:@"青蛙王子"];
            self.brandImageView.layer.cornerRadius = 5;
            self.brandImageView.clipsToBounds = YES;
            self.brandImageView.layer.borderColor = UIColorWithRGBA(229, 229, 229, 1).CGColor;
            self.brandImageView.layer.borderWidth = 1;
            
            //3.2
            self.brandTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.brandImageView.frame.size.height+self.brandImageView.frame.origin.y, self.smallModulView.frame.size.width, self.smallModulView.frame.size.height*0.4)];
            [self.smallModulView addSubview:self.brandTitleLabel];
            self.brandTitleLabel.text = @"青蛙王子";
            self.brandTitleLabel.textColor = UIColorWithRGBA(125, 125, 125, 1);
            self.brandTitleLabel.textAlignment = NSTextAlignmentCenter;
            self.brandTitleLabel.font = [UIFont boldSystemFontOfSize:12];
        }
    }
}
@end
